package com.guoxin.chapter1;

/**
 * 通过实现Runnable接口来创建线程
 *
 * @author guoxin
 * @date 2019/8/8
 */
public class CreateThread2 {

    private static class MyThread implements Runnable {
        @Override
        public void run() {
            System.out.println("MyThread");
        }
    }

    public static void main(String[] args) {
        Thread thread = new Thread(new MyThread());
        thread.start();
        //如果对此调用start()则会抛出异常。
        thread.start();
    }
}
